﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace PoemonAdventures
{
    class MenuScreen
    {
        KeyboardState kState;
        KeyboardState prevKState;
        int selection = 0;

        public void Update(GameTime gameTime)
        {
            prevKState = kState;
            kState = Keyboard.GetState();
            if (kState.IsKeyDown(Keys.Down) && kState != prevKState)
            {
                selection++;
            }
            else if (kState.IsKeyDown(Keys.Up) && kState != prevKState)
            {
                selection--;
            }
            else if (kState.IsKeyDown(Keys.Enter) && kState != prevKState)
            {
                switch (selection % 2)
                {
                    case (0):
                        ScreenManager.gameState = GameState.Story;
                        break;
                    case (1):
                        ScreenManager.gameState = GameState.Help;
                        break;
                }
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            switch (selection % 2)
            {
                case (0):
                    spriteBatch.DrawString(ScreenManager.osdFont, "-> PLAY", new Vector2(10, 10), Color.Yellow);
                    spriteBatch.DrawString(ScreenManager.osdFont, "HELP", new Vector2(10, 35), Color.Black);
                    break;
                case (1):
                    spriteBatch.DrawString(ScreenManager.osdFont, "PLAY", new Vector2(10, 10), Color.Black);
                    spriteBatch.DrawString(ScreenManager.osdFont, "-> HELP", new Vector2(10, 35), Color.Yellow);
                    break;
            }
            spriteBatch.End();
        }
    }
}
